Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Settings search now caches normalized row text instead of repeating that work on each keystroke. The change is limited to in-memory search processing, with no changes to product defaults, availability filtering, or persistent data. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Note Written by Merged current main without rebasing and resolved the settings-search conflict by keeping cached invariant fields alongside live translated labels. The diff against the merged base remains one file, 18 additions and 4 deletions. Verified At |
The per-row cache now also holds the two translated labels, reused while the same translate function is passed. gt-react returns a new one when the locale or its translations change, so a language switch rebuilds the entry and results follow the new language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Written by Claude Opus 5.5, replying on behalf of Victor I sent 73 keystrokes through the debugging port to Chrome on a dev server: after the first keystroke fills the cache, each one at |
|
Note 🤖 Opus 5.5 replying on behalf of Victor. I pushed |
|
Note 🤖 Opus 5.5 replying on behalf of Victor. Closing this: it is not a bug fix, and this repository now takes only bug fixes from outside contributors. The branch stays on my fork if it is useful. |

Problem
Settings search re-normalized every row on every search.
searchSettingsrannormalizeSearchText(NFKD, mark stripping, lowercasing, whitespace collapse) over each row's title, section label and search terms, and translated and normalized the title and section label again. The settings sidebar runs it on every keystroke, so each keystroke redid that work for every row, even though a row's text only changes with the UI language.Change
searchSettingsnow reads each row's normalized fields from a module-levelWeakMapkeyed by the row object, stored with the translate function they were built with. A search with the same translate function reuses them. gt-react hands out a new translate function when the locale or its translations change, and a row's entry is rebuilt then.SettingsSearchItemfields are allreadonly, and section labels are a module constant, so a cached entry can't drift from its row.Rejected alternatives: precomputing fields when the catalog is built would still need a fallback for the arbitrary
itemslistssearchSettingsaccepts. Memoizing in the sidebar component would leave the per-row work in the shared function.Scope and approval
No prior issue or discussion. This is a focused performance fix with no change to product behavior: the same rows appear for every query, in the same order. It touches
searchSettingsinsettingsSearch.tsand its test file. Clients: web and desktop, which share this code. Mobile does not use this search.Verification
Real browser on a dev server named "Test machine": Chrome 157 (headless), one revision at a time, main
cd8fc91a57, the earlier head892ef6f7b8and this head6a87912ff7. Each run typed 8 queries (theme, word wrap, font size, keybindings, worktree, notifications, git fetch, telemetry) into Settings search one key at a time, 73 keystrokes, with keys sent through the debugging port. Call counts come from Chrome's precise coverage and times from its sampling profiler at 20 µs: one count run and three timed runs per revision. It is a dev build, so absolute times run higher than production. The body runs long because it keeps the unedited per-run lines for all three revisions, folded below.In these logs
head2is892ef6f7b8andofferis this head6a87912ff7. Lines from the run logs, not altered:Per-run times and result lists
After the first keystroke fills the cache, a keystroke here normalizes only the query, and the time in
searchSettingsdrops from about 3 ms to about 0.2 ms. All runs returned the same results for all 8 queries.vp test run src/components/settings/settingsSearch.test.ts: 24 passed at6a87912ff7. The new testtranslates each row once per language instead of on every keystrokefails at892ef6f7b8(translate called 10 times on the second search) and passes here. The English/Spanish case now also checks that going back to English drops the Spanish match.vp run check:changedat6a87912ff7: format, lint, knip, typecheck, tests and React Compiler checks pass.UI: no screenshots. The same rows render in the same order.
Not checked:
Prior PRs
takeover verification
Merged main at
2bcbdae06a49, preserving translated search labels alongside the cache. Blacksmithvp run check:changedpassed, including 23 settings-search tests. Chrome verified repeated queries, normalization, empty results, and navigation. Desktop shares this search; mobile has no equivalent consumer. Browser timing and the Electron shell were not measured.Generated with Claude Opus 5.5 and GPT-6.1 Sol in T3 Code Nightly